<template>
  <div>
    <Title>表格</Title>
    <h3>这是表格页面</h3>
    <a-table
        :dataSource="dataSource"
        :columns="columns"
        :pagination="false"
        bordered
    />
  </div>
</template>

<script setup lang="ts">
  import User from '@/api/user'
  import {fetch} from '@/utils/useFetch'

  const dataSource = ref<any[]>([])
  const columns = [
    {
      title: '姓名',
      dataIndex: 'name',
      key: 'name'
    },
    {
      title: '年龄',
      dataIndex: 'age',
      key: 'age'
    },
    {
      title: '性别',
      dataIndex: 'genderName',
      key: 'genderName'
    },
    {
      title: '创建时间',
      dataIndex: 'date',
      key: 'date'
    }
  ]

  const {data} = await fetch('/users/select', {
    query: {
      pageNum: 1,
      pageSize: 10,
      name: ''
    },
  })
  dataSource.value = data

  /*function getTable() {
    User.getTable({
      pageNum: 1,
      pageSize: 10,
      name: ''
    }).then(res => {
      dataSource.value = res.data
    })
  }
  getTable()*/
</script>
